import { request } from '@/utils/request'

// 绑定推荐人
export const setInviter = (inviterMobile, memberId) =>
  request('Member/set_inviter', { inviter_mobile: inviterMobile, member_id: memberId })

// 获取用户首页信息
export const getMemberIndex = () => request('Member/index')
// 获取用户基本信息
export const getMemberInfo = () => request('Member/information')
// 编辑头像信息
export const editMemberAvatar = formData => request('Member/edit_memberavatar', formData)
// 退出登录
export const logout = username => request('Logout/index', { username: username, client: 'wap' })
/**
 * 修改登陆密码
 * @param {*} formData 提交表单的内容
 * formData.password 新密码
 * formData.password1 确认新密码
 */
export const editPassword = formData => request('Memberaccount/modify_password', formData)
/**
 * 修改支付密码
 * @param {*} formData 提交表单的内容
 * formData.password 新密码
 * formData.password1 确认新密码
 */
export const editPayPassword = formData => request('Memberaccount/modify_paypwd', formData)

/**
 * 编辑个人信息 昵称和出生年月要一起修改
 * @param {*} formData 提交表单的内容
 * formData.member_nickname: 要修改的昵称
 * formData.member_birthday: 出生年月
 * formData.member_qq: 用不上的参数.已有默认在
 * formData.member_ww: 用不上的参数。已有默认值
 */
export const editInformation = formData =>
  request('Member/edit_information', Object.assign({ member_qq: '', member_ww: '' }, formData))

/**
 * 绑定手机号第一步
 * 发送验证码
 */
export const bindMobileStep1 = mobile => request('Memberaccount/bind_mobile_step1', { mobile: mobile })

/**
 * 绑定手机第二部
 * 验证短信
 */
export const bindMobileStep2 = authCode => request('Memberaccount/bind_mobile_step2', { auth_code: authCode })
